import 'dart:convert';

void baseRequestAnalysisData(
  final future,
  Function(dynamic future) successBlock,
  Function(String info, int code) failBlock,
) {
  final model = baseAnalysisModelFromJson(future);
  if (model.code == 200) {
    successBlock(model.data);
  } else {
    failBlock(model.info ?? "", model.code ?? 0);
  }
}

// To parse this JSON data, do
//
//     final baseAnalysisModel = baseAnalysisModelFromJson(jsonString);

BaseAnalysisModel baseAnalysisModelFromJson(String str) => BaseAnalysisModel.fromJson(json.decode(str));

String baseAnalysisModelToJson(BaseAnalysisModel data) => json.encode(data.toJson());

class BaseAnalysisModel {
  BaseAnalysisModel({
    this.code,
    this.data,
    this.info,
  });

  int? code;
  dynamic data;
  String? info;

  factory BaseAnalysisModel.fromJson(json) => BaseAnalysisModel(
        code: json["code"],
        data: json["data"],
        info: json["info"],
      );

  Map<String, dynamic> toJson() => {
        "code": code,
        "data": data,
        "info": info,
      };
}
